package model

import "RoccBlog/global"

type User struct {
	Id         int        `json:"id" gorm:"primaryKey;autoIncrement"`
	NickName   string     `json:"nickName" gorm:"type:varchar(90)"`
	AvatarUrl  string     `json:"avatarUrl" gorm:"type:varchar(120)"`
	Username   string     `json:"username" gorm:"unique;type:varchar(30)"`
	Password   string     `json:"password" gorm:"type:varchar(512)"`
	Email      string     `json:"email" gorm:"unique;type:varchar(60);"`
	Age        int        `json:"age"`
	QQ         string     `json:"qq" gorm:"type:varchar(12)"`
	State      int        `json:"state" gorm:"type:enum('0','1','2');comment:0未激活 1正常 2禁用"`
	CreateTime *LocalTime `json:"createTime" gorm:"autoCreteTime;type:datetime"`
	UpdateTime *LocalTime `json:"updateTime" gorm:"autoUpdateTime;type:datetime"`
	LastTime   *LocalTime `json:"lastTime" gorm:"type:datetime"`
	Roles      []Role     `json:"roles" gorm:"many2many:user_role"`
}

func init() {
	global.RegisterModel(&User{})
}
